import { http } from '@/utils/http'

/** 查询字典类型列表 */
export const listType = (params?: object) => {
  return http.request<HttpPaginationResponse<Array<any>>>('get', '/system/dict/type/list', {
    params,
  })
}

/** 查询字典类型详细 */
export const getType = (dictId: number) => {
  return http.request<HttpResponse<Object>>('get', '/system/dict/type/' + dictId)
}

/** 新增字典类型 */
export const addType = (data?: object) => {
  return http.request<HttpResponse<Object>>('post', '/system/dict/type', {
    data,
  })
}

/** 修改字典类型 */
export const updateType = (data?: object) => {
  return http.request<HttpResponse<Object>>('put', '/system/dict/type', {
    data,
  })
}

/** 删除字典类型 */
export const delType = (dictId: number) => {
  return http.request<HttpResponse<Object>>('delete', '/system/dict/type/' + dictId)
}

/** 刷新字典缓存 */
export const refreshCache = () => {
  return http.request<HttpResponse<Object>>('delete', '/system/dict/type/refreshCache')
}

/** 获取字典选择框列表 */
export const optionselect = () => {
  return http.request<HttpResponse<any[]>>('get', '/system/dict/type/optionselect')
}
